package com.ossfk.jt808.pojo;

import java.io.Serializable;

import com.ossfk.net.session.TcpSession;

import lombok.Data;
import lombok.ToString;

@Data
public class Jt808Msg implements Serializable {
	private static final long serialVersionUID = 2588947753092042121L;
	
	/**
	 * 消息头+消息体+校验码的节数组
	 */
	@ToString.Exclude
	protected byte[] msgBytes;

	/**
	 * 16byte 消息头
	 */
	protected Jt808MsgHeader header;

	/**
	 * 消息体字节数组
	 */
	@ToString.Exclude
	protected byte[] msgBodyBytes;

	/**
	 * 校验码 1byte
	 */
	protected int checkSum;
	/**
	 * 消息当前会话
	 */
	protected TcpSession session;

	public Jt808Msg() {
	}

	public Jt808Msg(TcpSession session, int msgId) {
		this.session = session;
		this.header = new Jt808MsgHeader();
		// 消息id
		this.header.setMsgId(msgId);
		// 消息体属性 需要body长度
		this.header.setTerminalPhone(session.getPhoneNum());
	}
}
